/*
题目链接: https://leetcode.cn/problems/score-of-a-string/?envType=daily-question&envId=2025-03-15
*/

//题解代码 :
class Solution {
public:
    int scoreOfString(string s) {
        int n = s.size();
        int ans = 0;
        for(int i=0;i<n-1;++i) ans = ans + abs(s[i]-s[i+1]);
        return ans;
    }
};
